package com.crm.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.List;


/**
 * The persistent class for the CRM_DEPT database table.
 * 
 */
@Entity
@Table(name="CRM_DEPT")
@NamedQuery(name="CrmDept.findAll", query="SELECT c FROM CrmDept c")
public class CrmDept implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(initialValue=1,allocationSize=1,name="CRM_DEPT_CRMDEPTNO_GENERATOR", sequenceName="SEQ")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CRM_DEPT_CRMDEPTNO_GENERATOR")
	@Column(name="CRM_DEPTNO")
	private Long crmDeptno;

	@Column(name="CRM_DNAME")
	private String crmDname;

	@Column(name="IS_DEL")
	private String isDel;

	//bi-directional many-to-one association to Userinfo
	@OneToMany(mappedBy="crmDept")
	@JSONField(serialize = false)
	private List<Userinfo> userinfos;

	public CrmDept() {
	}

	public Long getCrmDeptno() {
		return this.crmDeptno;
	}

	public void setCrmDeptno(Long crmDeptno) {
		this.crmDeptno = crmDeptno;
	}

	public String getCrmDname() {
		return this.crmDname;
	}

	public void setCrmDname(String crmDname) {
		this.crmDname = crmDname;
	}

	public String getIsDel() {
		return this.isDel;
	}

	public void setIsDel(String isDel) {
		this.isDel = isDel;
	}

	public List<Userinfo> getUserinfos() {
		return this.userinfos;
	}

	public void setUserinfos(List<Userinfo> userinfos) {
		this.userinfos = userinfos;
	}

	public Userinfo addUserinfo(Userinfo userinfo) {
		getUserinfos().add(userinfo);
		userinfo.setCrmDept(this);

		return userinfo;
	}

	public Userinfo removeUserinfo(Userinfo userinfo) {
		getUserinfos().remove(userinfo);
		userinfo.setCrmDept(null);

		return userinfo;
	}

}